package com.wudl.file.remote.controller;

import com.wudl.common.api.CommonResult;
import com.wudl.file.remote.domain.FileInfo;
import com.wudl.file.remote.feign.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ：wudl
 * @date ：Created in 2022-03-23 22:29
 * @description：
 * @modified By：
 * @version: 1.0
 */

@RestController
@RequestMapping("/file")
public class FileController {


    @Autowired
    FileService fileService;

    @GetMapping("/file")
    public String getSuccess()
    {
        return "success";
    }

    @GetMapping(value = "/listFiles")
    public CommonResult<List<FileInfo>> listFiles(@RequestParam("bucket") String bucket) {
        CommonResult<List<FileInfo>> listCommonResult = fileService.listFiles(bucket);
        return listCommonResult;
    }

}
